package org.lds.hotkey.console.business.app.converter;

import org.lds.hotkey.console.business.app.entity.App;
import org.lds.hotkey.console.business.app.model.request.AppBaseUpdateRequest;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;


@Component
public class AppBaseUpdateRequestToEntityConverter implements Converter<AppBaseUpdateRequest, App> {

    @Override
    public App convert(AppBaseUpdateRequest source) {
        return App.builder()
                .id(source.getId())
                .name(source.getName())
                .enable(source.getEnable())
                .modifier(source.getModifier())
                .updateTime(LocalDateTime.now())
                .build();
    }

}


